import { StoreContext } from "@/store"
import { useMobx } from "@whzhuke/mobx"
import React, { useContext, useLayoutEffect } from "react"
import { Outlet, useNavigate } from "react-router"
const Layout = useMobx(() => {
  const { UserStore } = useContext(StoreContext)
  const nav = useNavigate()
  useLayoutEffect(() => {
    UserStore.user && nav(`/home/dash`, { replace: true })
  }, [UserStore.user])
  return <Outlet />
})
export default Layout
